<template>
	<view class="edit">
		<!-- 头部 -->
		<!-- #ifndef MP-WEIXIN -->
		<public-header :title="title"></public-header>
		<view class="hei_100"></view>
		<!-- #endif -->
		<!-- end -->

		<!-- 功能 -->
		<view v-show="val" class="nav padd_32" style="margin-top: 30rpx;">
			<view class="image" @click="see()">
			    <tki-qrcode
			    ref="qrcode"
				:cid="cid"
			    :val="val"
			    :size="size"
				:background="background"
				:foreground="foreground"
				:pdground="pdground"
				:lv="lv"
				:onval="onval"
				:loadMake="loadMake"
				:show="show"
				:icon="icon"
				@result="qrR()"
			     />
			</view>
		</view>
		<!-- end -->
		
	</view>
</template>

<script>
import PublicHeader from '@/components/PublicHeader.vue';
import { mapState, mapMutations } from 'vuex';
import store from "@/store/index.js";
import tkiQrcode from "@/pageageA/components/tki-qrcode/tki-qrcode.vue";
export default {
	components: {
		PublicHeader,
		tkiQrcode
	},
	computed: mapState(['hasLogin', 'uerInfo']),
	data() {
		return {
			title: '个人中心',
			val:"",
			size:600,
			background:"#ffffff",
			foreground:"#000000",
			pdground:"#000000",
			loadMake:true,
			onval:true,
			lv:3,
			show:true,
			cid:'qrcode',
			code:'',
			icon:'/static/images/wx.png'
		};
	},
	onLoad() {
		var _this = this;
		let url = 'https://www.beedao.tech/?sid=' + this.uerInfo.userId
		_this.val = url;
		if (this.hasLogin) {
			_this.$http
				.get('/personal/center/getuser/' + this.uerInfo.userId)
				.then(function(response) {
					_this.uers = response.data;
					console.log('个人信息', _this.uers);
				})
				.catch(function(error) {
					console.log(error);
				});
		}; 
	},
	methods: {
		qrR(res) {
			var that = this
			that.code = uni.getStorageSync('code');
		},
		see() {
			let images = [this.code]
			console.log(images,"iiii")
			// 预览图片长按
			uni.previewImage({
				urls: images,
				longPressActions: {
					itemList: ['发送给朋友', '保存图片', '收藏'],
					success: function(data) {
						console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
					},
					fail: function(err) {
						console.log(err.errMsg);
					}
				}
			});
		}
	}
};
</script>

<style scoped lang="scss">
.nav {
	margin-top: 16rpx;
}
.nav-list {
	width: 100%;
	height: 104rpx;
	line-height: 104rpx;
	font-size: 34rpx;
	color: #666;
	border-bottom: 1rpx solid #dfdfdf;
}
.nav-list:last-child {
	border: 0 none;
}
.nav-list .fr .fl {
	color: #888;
	font-size: 28rpx;
}
.icon {
	width: 13rpx;
	margin-left: 20rpx;
	margin-top: 42rpx;
}
.portrait {
	width: 66rpx;
	height: 66rpx !important;
	border-radius: 50%;
	background-color: #999;
	margin-top: 20rpx;
}
.cont {
	width: 540rpx;
	padding-top: 40rpx;
	font-size: 30rpx;
	color: #a4a9b0;
	background-color: #fff;
	border-radius: 16rpx;
}
.cont .title {
	color: #333;
	font-size: 34rpx;
	text-align: center;
	line-height: 48rpx;
	margin-bottom: 40rpx;
}
.cont input {
	width: 390rpx;
	height: 80rpx;
	line-height: 80rpx;
	margin: 0 auto;
	padding-left: 30rpx;
	background-color: #f6f6f9;
}
.cont .clearfix {
	margin-top: 40rpx;
	height: 90rpx;
	line-height: 90rpx;
}
.cont .clearfix view {
	width: 49%;
	font-size: 32rpx;
	color: $uni-color1;
	text-align: center;
	font-weight: 500;
}
.cont .clearfix .fl {
	border-right: 1rpx solid #e7e7e7;
	font-weight: 400;
}
.cont_sex{
	background-color: #fff;
	text-align: center;
}
.cont_sex view{
	height: 112rpx;
	line-height: 112rpx;
	font-size: 34rpx;
	border-bottom: 1rpx solid #E7E7E7;
}
.cont_sex view:last-child{
	border-top: 10rpx solid #F6F6F9;
}
.image{
	width: 600rpx;
	height: 600rpx;
	margin-top: 20rpx;
	margin-left: 6%;
	box-shadow: 0px 7rpx 26rpx 0px rgba(0, 0, 0, 0.1);
}
.text{
	width: 686rpx;
	text-align: center;
	// margin-left: 32rpx;
}
</style>
